﻿@using LanDBom.Models
@using LanDBom.Resources
@{
    ViewBag.Title = "Price_main";
}
<div>
    <from>
        <fieldset class="boun">
            <legend></legend>
            <div class="row bian">
                <label class="col-sm-3 breadcrumb-item">步骤五：采购核价</label>
                <ul id="lisul" class="row col-sm-5">
                    <li class="lisu"></li>&rArr;
                    <li class="lisu"></li>&rArr;
                    <li class="lisu"></li>&rArr;
                    <li class="lisu"></li>&rArr;
                    <li class="lisu">5</li>&rArr;
                    <li class="lisu"></li>&rArr;
                    <li class="lisu"></li>
                </ul>
            </div>
        </fieldset>
    </from>
</div>
<div>
    <from class="from-horizontal">
        <div>
            <fieldset class="boun nav" style="padding-bottom:6px;">
                <legend class="len">@Resource.String155</legend>
                <div class="col-lg-3">@Resource.String163:<input type="text" style="width:150px;" id="txtbian" /></div>
                <div class="col-lg-3">@Resource.String164:<input type="text" style="width: 150px;" id="txtKH" /></div>
                <div class="col-lg-3">@Resource.String165:<input type="text" style="width: 150px;" id="txtqishi" /></div>
                <div calss="col-lg-3"><button id="findApp" class="btn-sm  btn-secondary">@Resource.String155</button>&nbsp;&nbsp;<button id="reste" class="btn-sm btn-secondary">返回</button></div>
            </fieldset>
            <div style="display: none; position: fixed; background-color:dimgray;max-height:70%;width:80%" id="black_BOX" class="row">
                <div class="Tuodong" style=" background-color: #bacee9; height: 18px;"><span>点击这里拖动窗体</span></div>
                <div class="row" style="margin-left:0">
                    <div id="black_BOX_TC" class="col-lg-2" style="color:white;text-align:center ">@Resource.String166</div>
                    <div id="black_BOX_YJTJ" class="col-2" style="color:white;text-align:center ">上传文件</div>
                    <div id="shenqiangdan" class="col-2" style="display:none"></div>
                    <div id="CG_SH" class="col-lg-2" style="color:white;text-align:center">开始核价</div>
                    <div id="CG_BCXJ" class="col-lg-2" style="color:white;text-align:center">补充询价</div>
                    <div id="CG_gycz" class="col-lg-2" style="color:white;text-align:center">工艺重置</div>
                    <div id="CG_plhj" class="col-lg-2" style="color:white;text-align:center">批量回价</div>
                    <div>
                        <select id="gysname">
                            <option value="0">--请选择--</option>
                        </select>
                    </div>
                </div>
                <div>
                    <div><button class="JJJMKM" style="background-color:red">生成回价单</button><button class="JJJMKM1">回价详情</button><button class="PLsanc" style="display:none">批量删除</button></div>
                    <table class="table table-sm gun" style="background-color: #FFFFFF" id="one_09">
                        <thead class="thead-light">
                            <tr>
                                <th>序号</th>
                                <th>申请单号</th>
                                <th>询价负责人</th>
                                <th>生成回价单</th>
                            </tr>
                        </thead>
                        <tbody data-spy="scroll" id="CG_Inf_Tbody">
                        </tbody>
                    </table>
                    @*<table class="table table-sm gun" style="background-color: #FFFFFF;display:none" id="one_091">
                        <thead class="thead-light">
                            <tr>
                                <th><input type="checkbox" id="HJ_All_cb" /></th>
                                <th>单号</th>
                                <th>申请单号</th>
                                <th>物料名</th>
                                <th>料号</th>
                                <th>阶梯</th>
                                <th>描述</th>
                                <th>供应商</th>
                                <th>最晚回价日期</th>
                                <th>回价价格</th>
                                <th>模具费用</th>
                                <th>生产周期</th>
                                <th>印版费用</th>
                                <th>状态</th>
                            </tr>
                        </thead>
                        <tbody id="CG_Inf_T" style="overflow:scroll">
                        </tbody>
                    </table>*@
                    <div class="table-container" style="max-height: 65vh; overflow-y: auto; display:none;background-color: #FFFFFF;"id="one_091">
                        <table class="table table-sm gun">
                            <thead class="thead-light">
                                <tr>
                                    <th><input type="checkbox" id="HJ_All_cb" /></th>
                                    <th>单号</th>
                                    <th>申请单号</th>
                                    <th>物料名</th>
                                    <th>料号</th>
                                    <th>阶梯</th>
                                    <th>描述</th>
                                    <th>供应商</th>
                                    <th>最晚回价日期</th>
                                    <th>回价价格</th>
                                    <th>模具费用</th>
                                    <th>生产周期</th>
                                    <th>印版费用</th>
                                    <th>状态</th>
                                </tr>
                            </thead>
                            <tbody id="CG_Inf_T">
                                <!-- 表格行将通过JavaScript动态添加 -->
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div class="YCFile" id="YCFile" style="display: none; background-color: #fff; width: 350px; height: 150px; position: absolute; left: 22%; top: 40%;">
            <div class="YANds"><span>@Resource.String108</span><span><i class="bi bi-x-circle-fill" id="Quxiao"></i></span></div>
            <div class="SHnacs">
                <input type="file" value="" id="SHanngcF" accept="" />
                <input type="button" value="@Resource.String108" id="TIjaio" />
            </div>
        </div>
        <div class="tab">
            <fieldset class="boun nav">
                <legend class="len">申请单</legend>
                <table class="table table-sm gun">
                    <thead class="thead-light">
                        <tr class="GEN-cent">
                            <th scope="col" style="width:60px">@Resource.String156</th>
                            <th scope="col">@Resource.String179</th>
                            <th scope="col" style="width:370px;">@Resource.String180</th>
                            <th scope="col">@Resource.String181</th>
                            <th scope="col">@Resource.String182</th>
                            <th scope="col">@Resource.String183</th>
                            <th scope="col">@Resource.String184</th>
                            <th scope="col">@Resource.String202</th>
                        </tr>
                    </thead>
                    <tbody id="AppTable" style="height:500px;">
                    </tbody>
                </table>
            </fieldset>
        </div>
        <div id="WT_dh_mb2" style="display: none; position: absolute; border: 1px black solid; left: 25%; top: 33%; background-color: white; background-color: #f1f1f1;height:200px;width:300px">
            <div style="text-align: right; background-color: #84acde;"><span class="WT_qxbh2" style=" margin: 20px;"><i class="bi bi-x-square"></i></span></div>
            <div style="margin: 20px 10px; padding: 10px; background-color: #fff;">
                <div id="WJ_XZLJ"></div>
            </div>
            <div style="text-align:center"><button class="WT_qxbh2">@Resource.String126</button></div>
        </div>
    </from>
    <div id="jhsdjkqk" style="display: none;"></div>
</div>

<div id="WT_dh_A" style="display: none; position: absolute; border: 1px black solid; left: 25%; top: 33%; background-color: white; background-color: #f1f1f1;width:400px;height:150px">
    <div style="text-align: right; background-color: #84acde;"><span class="WT_qxbh2" style=" margin: 20px;"><i class="bi bi-x-square"></i></span></div>
    <div id="WJ_ID" style="display:none"></div>
    <div class="row">
        <div class="col-4">@Resource.String201：</div>
        <div id="WT_dhr2" class="col-8"></div>
    </div>
    <p></p>
    <div class="row">
        <div class="col-4">@Resource.String202</div>
        <div class="col-8"><textarea class="col-12" id="WT_dhly2"></textarea></div>
    </div>
    <p></p>
    <div style="text-align:center">
        <button class="JIHNNM">@Resource.String203</button>
    </div>
</div>



@section scripts
{
    <script src="~/Scripts/jquery-3.4.1.min.js"></script>
    <script src="~/Scripts/bootstrap.min.js"></script>
    <script>
        $(function () {
            $("#li6").css({ "color": "black", "background-color": "white" })
            //加载询价信息
            $(document).on("click", "#CG_ZT", function (e) {
                var SQ_CG = $(e.target).text()
                console.log(SQ_CG)
                $("#jhsdjkqk").text(SQ_CG)
                $("#black_BOX").css({ "display": "block" })

                $.ajax({
                    url: '/Procure/Price_main',
                    type: 'GET',
                    data: { "App_bian": SQ_CG, "state": 8 },
                    success: function (data) {
                        createTRswd(data);
                    },
                    error: function () {
                        alert('Request Error');
                    }
                })

                $.ajax({
                    url: '/Procure/Overview',
                    type: 'GET',
                    data: { "App_bian": SQ_CG, "state": 2 },
                    success: function (data) {
                        createTR(data);
                    },
                    error: function () {
                        alert('Request Error');
                    }
                })

                var string = $("#change").val()
                $.ajax({
                    url: '/Procure/Price_main',
                    type: 'GET',
                    data: { "App_bian": SQ_CG, "id": $("#Login_name").text(), "state": 9, "App_xiang": string },
                    success: function (data) {
                        createTR29(data);
                    },
                    error: function () {
                        alert('Request Error');
                    }
                })
            })

            $(document).on("click", "#CG_BCXJ", function () {
                var sqd = $("#shenqiangdan").text()
                console.log(sqd)
                window.location.href = "/Procure/Detailed?APP_bian=" + sqd + "&dasdnfj=补充询价";
            })

            $(document).on("click", "#CG_gycz", function () {
                var sqd = $("#shenqiangdan").text()
                console.log(sqd)
                window.location.href = "/Material/Index?names=" + sqd + "&aewd=重新配置";
            })

            $(document).on("click", ".WT_qxbh2", function () {
                $("#WT_dh_mb2").css({ "display": "none" })
                $("#WJ_XZLJ a").remove()
            })
            $(".JJJMKM").click(function () {
                $(".JJJMKM").css({ "background": "red" })
                $(".JJJMKM1").css({ "background": "none" })
                $("#one_091").hide()
                $(".PLsanc").hide()
                $("#one_09").show()
            })
            $(".JJJMKM1").click(function () {
                $(".JJJMKM").css({ "background": "none" })
                $(".JJJMKM1").css({ "background": "red" })
                $("#one_091").show()
                $(".PLsanc").show()
                $("#one_09").hide()
            })

            $(document).on("click", "#schjd", function (e) {
                var bian = $(e.target).parent().parent().children().eq(1).text()
                var name = $(e.target).parent().parent().children().eq(2).text()
                $.ajax({
                    url: '/Procure/DownloadExcel',
                    type: 'POST',
                    data: { "bian": bian, "name": name, "state": 1 },
                    success: function (data) {
                        $("#WT_dh_mb2").css({ "display": "block" })
                        $("#WJ_XZLJ").append($(`<a href="/Contracts/Download_file?path=${data}" id="log_SZ" class="WT_qxbh2">下载</a>`))
                    },
                    error: function () {
                        alert('Request Error');
                    }
                })
            })
            $(document).on("change", "#gysname", function (e) {
                var string = $("#gysname").val()
                var SQ_CG = $("#jhsdjkqk").text()
                $.ajax({
                    url: '/Procure/Price_main',
                    type: 'GET',
                    data: { "App_bian": SQ_CG, "id": $("#Login_name").text(), "state": 9, "App_xiang": string },
                    success: function (data) {
                        console.log(data)
                        createTR29(data);
                    },
                    error: function () {
                        alert('Request Error');
                    }
                })
            })
            //打印询价信息表格
            function createTRswd(data) {
                console.log(data)
                $('#gysname option').remove();
                $('#gysname').append($(` <option value="0">--请选择--</option>`));
                var index = 1
                var hadhkw = $("#jhsdjkqk").text()
                $.each(data, function (i, item) {
                    var $tr = $(` <option value="${item.Inf_gong}">${item.Inf_gong}</option>`);
                    $('#gysname').append($tr);
                })
            }

            function createTR(data) {
                console.log(data)
                $('#CG_Inf_Tbody tr').remove();
                var index = 1
                var hadhkw = $("#jhsdjkqk").text()
                $.each(data, function (i, item) {
                    $("#shenqiangdan").text(hadhkw)
                    var $tr =
                        $(` <tr>
                                                <td>${index}</td>
                                                <td>${hadhkw}</td>
                                                <td style="display:none">${item.dl_id}</td>
                                                <td>${item.DE_nae}</td>
                                                <td><a href="#" id="schjd">生成回价单</a></td>
                                            </tr>

                                                `);

                    if ($("#Login_sf").text() == "项目发展部经理" || $("#Login_sf").text() == "采购主管") {
                        $('#CG_Inf_Tbody').append($tr);
                        index++
                    }
                    else if ($("#Login_sf").text() == "采购员") {
                        if (item.dl_id == $("#Login_name").text()) {
                            $('#CG_Inf_Tbody').append($tr);
                            index++
                        }
                    }
                })
            }
            function createTR29(data) {
                $('#CG_Inf_T tr').remove();
                $.each(data, function (i, item) {
                    $("#shenqiangdan").text(item.Inf_shen)
                    var $tr = $(` <tr>
                                                    <td style="width:20px"><input type="checkbox" name="HJ_TJK" /></td>
                                                    <td id="Inf_id">${item.Inf_id}</td>
                                                    <td>${item.Inf_shen}</td>
                                                    <td>${item.Inf_wu}</td>
                                                    <td>${item.Inf_liao}</td>
                                                    <td>${item.Inf_JT}</td>
                                                    <td>${item.Inf_nian}</td>
                                                    <td>${item.Inf_gong}</td>
                                                    <td>${item.Inf_huiTime}</td>
                                                    <td><input style="width:50px" name="GYSJG" value="${item.Inf_huiP}" type="number" class="huiji"/></td>
                                                    <td><input style="width:50px" name="GYSew" value="${item.Inf_ewfy}" type="number" class="huiji"/></td>
                                                    <td><input style="width:50px" name="GYSzq" value="${item.Inf_sczq}" type="number" class="huiji"/></td>
                                                    <td><input style="width:50px" name="GYSyb" value="${item.Inf_ybfy}" type="number" class="huiji"/></td>
                                                    <td id="inf_zHUaNg">${item.Inf_zhuang}</td>
                                                    <td ><a id="CG_HJ" href="#">回价</a><td>
                                                </tr>
                                                       `);

                    if ($("#Login_sf").text() == "项目发展部经理" || $("#Login_sf").text() == "采购主管" || $("#Login_zj").text() > 2) {
                        $('#CG_Inf_T').append($tr);
                    }
                    else if ($("#Login_sf").text() == "采购员") {
                        $.ajax({
                            url: '/Procure/Price_main',
                            type: 'POST',
                            data: { "Inf_ids": item.Inf_id, "id": $("#Login_name").text(), "state": 7 },
                            success: function (date) {
                                if (date == "添加") {
                                    $('#CG_Inf_T').append($tr);
                                }
                            },
                            error: function () {
                                alert("错误 请重试!")
                            }
                        })
                    }
                })
            }
            $("#TIjaio").click(function () {
                var fileUpload = $('#SHanngcF')[0];
                if (fileUpload.files.length > 0) {
                    var formData = new FormData();
                    formData.append('file', fileUpload.files[0]);
                    console.log(formData)
                    $.ajax({
                        url: '/Procure/ExcelFilePath',
                        type: 'POST',
                        data: formData,
                        processData: false,		//用于对data参数进行序列化处理 这里必须false
                        contentType: false,
                        success: function (fgggh) {
                            alert(fgggh)
                        },
                        error: function (xhr) {
                            alert("系统错误" + xhr);
                        }
                    })

                } else {
                    alert('请选择要上传的文件！');
                }
            })

            //批量提交供应商回价
            $(document).on("click", "#black_BOX_YJTJ", function () {
                $("#YCFile").css({ "display": "block" })
            })
            //关闭文件上传
            $(document).on("click", "#Quxiao", function () {
                $("#YCFile").css({ "display": "none" })
            })
            //添加步骤自增
            //$(document).on('click', '#CG_SH', function (e) {
            //    var CG_INFSQD = $(e.target).prev().prev().prev().prev().prev().prev().prev().prev().prev().prev().text()
            //    $.ajax({
            //        url: '/Procure/Index',
            //        type: 'POST',
            //        data: { "CG_INFSQD": CG_INFSQD },
            //        success: function (data) {
            //        },
            //        error: function () {
            //            alert('Request Error');
            //        }
            //    })
            //})
            //转跳到核价页面
            $(document).on('click', '#CG_SH', function (e) {
                var CG_INFSQD = $("#shenqiangdan").text()
                var index = 0
                $.ajax({
                    url: '/Procure/Price_main',
                    type: 'POST',
                    data: { "App_bian": CG_INFSQD, "id": $("#Login_name").text(), "state": 6 },
                    success: function (data) {
                        if (data == "可以") {
                            window.location.href = "/Procure/pricing_New?APP_bian=" + CG_INFSQD;
                        }
                        else {
                            alert("供应商回价未提交，请等待更多供应回价或添加询价供应商")
                        }
                    },
                    error: function () {
                        alert('Request Error');
                    }
                })
            })

            //打开回价隐藏页面
            $("#black_BOX_TC").click(function () {
                $("#black_BOX").css({ "display": "none" })
                $("#CG_Inf_Tbody tr").remove()
            })
            $(document).on("click", ".PLsanc", function () {
                var CG_XX = []
                $("input[name=HJ_TJK]:checked").parent().parent().each(function (i, item) {
                    CG_XX.push({
                        Inf_id: $("td[id=Inf_id]", item).text()
                    })
                })
                console.log(CG_XX)
                if (CG_XX.length > 0) {
                    $.ajax({
                        url: "/Procure/PLsancInf",
                        type: 'POST',
                        data: JSON.stringify(CG_XX),
                        contentType: "application/json;charset=utf-8",
                        dataType: "json",
                        success: function (text2) {
                            alert(text2)
                            var string = $("#gysname").val()
                            var SQ_CG = $("#jhsdjkqk").text()
                            $.ajax({
                                url: '/Procure/Price_main',
                                type: 'GET',
                                data: { "App_bian": SQ_CG, "id": $("#Login_name").text(), "state": 9, "App_xiang": string },
                                success: function (data) {
                                    console.log(data)
                                    createTR29(data);
                                },
                                error: function () {
                                    alert('Request Error');
                                }
                            })
                        },
                        error: function (text) {
                            alert("系统错误" + text);
                        }
                    })
                } else {
                    alert("请选择一条及以上！")
                }

            })
            $(document).on("click", "#CG_plhj", function () {
                var CG_XX = []
                $("input[name=HJ_TJK]:checked").parent().parent().each(function (i, item) {
                    CG_XX.push({
                        Inf_id: $("td[id=Inf_id]", item).text(),
                        Inf_huiP: $("input[name=GYSJG]", item).val(),
                        Inf_ewfy: $("input[name=GYSew]", item).val(),
                        Inf_sczq: $("input[name=GYSzq]", item).val(),
                        Inf_ybfy: $("input[name=GYSyb]", item).val(),
                    })
                })
                console.log(CG_XX)
                $.ajax({
                    url: "/Procure/Modify_All_GYS_HJ",
                    type: 'POST',
                    data: JSON.stringify(CG_XX),
                    contentType: "application/json;charset=utf-8",
                    dataType: "json",
                    success: function (text2) {
                        console.log(text2, text2 == "1")
                        if (text2 != 0) {
                            alert("回价成功")
                            $("input[name=HJ_TJK]:checked").parent().parent().each(function (i, item) {
                                $("td[id=inf_zHUaNg]").text("已提交")
                            })
                        } else {
                            alert("有未回价物料！")
                        }
                    },
                    error: function (text) {
                        alert("系统错误" + text);
                    }
                })
            })
            //提交供应商回价信息
            $(document).on('click', '#CG_HJ', function (e) {
                var CG_GYSHJ = $(e.target).parent().parent().children().eq(9).children().first().val();
                var CG_GYSew = $(e.target).parent().parent().children().eq(10).children().first().val();
                var CG_GYSzq = $(e.target).parent().parent().children().eq(11).children().first().val();
                var CG_GYSyb = $(e.target).parent().parent().children().eq(12).children().first().val();
                var CG_HJZT = $(e.target).prev().text();
                var CG_INFID = $(e.target).parent().parent().children().eq(1).text();
                if (CG_GYSHJ == "") {
                    alert("请输入供应商的回价")
                }
                else {
                    var gys_wl_jg = {
                        Inf_id: CG_INFID,
                        Inf_zhuang: "已提交",
                        Inf_huip: CG_GYSHJ,
                        Inf_ewfy: CG_GYSew,
                        Inf_sczq: CG_GYSzq,
                        Inf_ybfy: CG_GYSyb
                    }
                    $.ajax({
                        url: "/Procure/Modify_GYS_HJ",
                        type: "POST",
                        data: gys_wl_jg,
                        success: function (data) {
                            if (data == "修改成功")
                                alert(data);
                        },
                        error: function (data) {
                            alert("erroer ");
                        },
                    })
                }
                var SQ_CG = $("#jhsdjkqk").text()
                var string = $("#change").val()
                $.ajax({
                    url: '/Procure/Price_main',
                    type: 'GET',
                    data: { "App_bian": SQ_CG, "id": $("#Login_name").text(), "state": 9, "App_xiang": string },
                    success: function (data) {
                        $(e.target).parent().prev().text("已提交")
                    },
                    error: function () {
                        alert('Request Error');
                    }
                })
            })
            //全选
            $(document).on("click", "#HJ_All_cb", function (e) {
                if ($(e.target).prop("checked")) {
                    $("input[name='HJ_TJK']").each(function (i, item) {
                        var x = $(item).parent().parent().children().eq(9).children().val()
                        if (x != "") {
                            $(item).prop("checked", true);
                        }
                    })
                }
                else {
                    $("input[name='HJ_TJK']").prop("checked", false);
                }
            })
            $(document).on("click", ".BOhuijl", function (e) {
                //驳回理由
                var bian = $(this).parent().children().eq(1).text();
                $.ajax({
                    url: '/Procure/Price_main',
                    type: 'GET',
                    data: { "CG_INFSQD": bian, "state": 14 },
                    success: function (KKMJ) {
                        if (KKMJ == "") {
                            alert("无驳回记录！")
                            return
                        }
                        $("#WT_dh_A").show()
                        var shn = KKMJ.split(':')
                        console.log(shn)
                        $("#WT_dhly2").val(shn[1])
                        $("#WT_dhr2").text(shn[0])
                    },
                    error: function () {
                        alert('Request Error');
                    }
                })
            })
            $(document).on("click", ".JIHNNM", function () {
                $("#WT_dh_A").hide()
            })
            find_sqd()
            //搜索询价申请单的方法
            function find_sqd() {
                var txtbian = $("#txtbian").val();
                var txtKH = $("#txtKH").val();
                var txtqishi = $("#txtqishi").val();
                $.ajax({
                    url: '/Procure/Price_main',
                    type: 'GET',
                    data: { "App_bian": txtbian, "App_KHname": txtKH, "App_xiang": txtqishi, "state": 1 },
                    success: function (data) {
                        createRow(data);
                    },
                    error: function () {
                        alert('Request Error');
                    }
                })
            }
            function createRow(data2) {
                $('#AppTable tr').remove();
                var indsjkdjk = 1;
                $.each(data2, function (i, item) {
                    /*$.ajax({
                        url: '/Procure/Price_main',
                        type: 'GET',
                        data: { "App_bian": item.AP_bian, "state": 5 },
                        success: function (data) {*/
                    var bians = item.AP_bian
                    var index = ""
                    var STEN = '';
                    if (item.App_zhuang == "1") {
                        STEN = '<td class="BOhuijl" style="color:red">驳回理由</td>';
                    } else {
                        STEN = '<td class="BOhuijl"></td>';
                    }
                    $.ajax({
                        url: '/Procure/Overview',
                        type: 'POST',
                        data: { "App_bian": bians, "state": 3 },
                        success: function (data) {
                            if (($("#Login_sf").text() == "采购主管" || $("#Login_sf").text() == "业务发展部经理") && item.App_bu == "5") {
                                var $tr = $(` <tr style="height:50px">
                                                <td style="width:60px">${indsjkdjk}</td>
                                                <td><a id="CG_ZT" href="#">${item.AP_bian}</a></td>
                                                <td style="width:370px">${item.App_Kehu}</td>
                                                <td>${item.App_qishi}</td>
                                                <td>${item.App_JTime}</td>
                                                <td>${item.APP_name}</td>
                                                <td>${data}</td>
                                                ${STEN}
                                            </tr>
                                            `);
                                $('#AppTable').append($tr);
                                indsjkdjk++
                            }
                            else if ($("#Login_sf").text() == "采购员") {
                                $.ajax({
                                    url: '/Procure/Price_main',
                                    type: 'GET',
                                    data: { "App_bian": bians, "state": 11, "id": $("#Login_name").text() },
                                    success: function (date) {
                                        console.log(date)
                                        var $tr = $(`
                                                    <tr style="height:50px">
                                                        <td style="width:60px">${indsjkdjk}</td>
                                                        <td><a id="CG_ZT"  href="#">${item.AP_bian}</a></td>
                                                        <td style="width:370px">${item.App_Kehu}</td>
                                                        <td>${item.App_qishi}</td>
                                                        <td>${item.App_JTime}</td>
                                                        <td>${item.APP_name}</td>
                                                        <td>${data}</td>
                                                         ${STEN}
                                                    </tr>
                                                    `);
                                        if (date == "添加") {
                                            $('#AppTable').append($tr);
                                            indsjkdjk++
                                        }
                                    },
                                    error: function () {
                                        alert('Request Error');
                                    }
                                })
                            }
                        },
                        error: function (data) {
                        }
                    })
                    /* },
                     error: function () {
                         alert('Request Error');
                     }
                 })*/
                })
                var len = $("#AppTable tr").length;
                console.log(len)
                for (var i = 0; i < len; i++) {
                    $('#AppTable tr:eq(' + i + ')').children().eq(0).text(i + 1);
                }
            }
            //打印申请表信息
            $("#findApp").click(function () {
                find_sqd()
            })
        })

    </script>
}